package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.inflowManagement.*;
import com.bf.electroplating.service.IInflowManagementService;
import com.bf.electroplating.util.idempotent.Idempotent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 进水管控管理表 前端控制器
 * </p>
 *
 * @author gzd
 * @since 2025-08-21
 */
@Tag(name = "进水管理")
@RestController
@RequestMapping("/electroplating/inflowManagement")
public class InflowManagementController {

    @Resource
    private IInflowManagementService inflowManagementService;

    @PostMapping( "/pageList" )
    @Operation( summary = "分页查询进水管理列表", description = "分页查询进水管理列表" )
    public ResultVO <Page<InflowManagementVO>> pageList (@RequestBody InflowManagementQueryDTO queryDTO ) {
        return inflowManagementService.pageList ( queryDTO );
    }

    @Idempotent
    @PostMapping ( "/saveData" )
    @Operation ( summary = "新增/编辑进水管理", description = "新增/编辑进水管理" )
    public ResultVO< String > saveData (@RequestBody @Validated InflowManagementDTO dto ) {
        return inflowManagementService.saveData ( dto );
    }

    @PostMapping ( "/delete" )
    @Operation ( summary = "删除进水管理", description = "删除进水管理" )
    public ResultVO < String > delete ( @RequestBody List< String > ids ) {
        return inflowManagementService.delete ( ids );
    }

    @PostMapping ( "/detail" )
    @Operation ( summary = "获取进水管理详情", description = "获取进水管理详情" )
    public ResultVO < InflowManagementVO > getDetail ( @RequestBody IdDTO idDTO ) {
        return inflowManagementService.getDetail ( idDTO.getId () );
    }


    @PostMapping ( "/getAnalysis" )
    @Operation ( summary = "获取进水管理统计", description = "获取进水管理统计" )
    public  ResultVO<List<InflowManagementAnalysisVO>> getAnalysis (@Validated @RequestBody InflowManagementAnalysisDTO inflowManagementAnalysisDTO ) {
        return inflowManagementService.getAnalysis (inflowManagementAnalysisDTO );
    }

    @PostMapping ( "/getAnalysis-neo" )
    @Operation ( summary = "获取进水管理统计--新折线图", description = "获取进水管理统计--新折线图" )
    public  ResultVO<List<InflowManagementAnalysisNeoVO>> getAnalysisNeo (@Validated @RequestBody InflowManagementAnalysisNeoDTO inflowManagementAnalysisDTO ) {
        return inflowManagementService.getAnalysisNeo (inflowManagementAnalysisDTO );
    }


    @PostMapping ( "/getAnalysis-factor" )
    @Operation ( summary = "获取进水管理统计--因子折线图", description = "获取进水管理统计--因子折线图" )
    public  ResultVO<List<InflowManagementAnalysisNeoVO>> getAnalysisWithFactor (@Validated @RequestBody InflowManagementAnalysisFactorDTO inflowManagementAnalysisDTO ) {
        return inflowManagementService.getAnalysisWithFactor (inflowManagementAnalysisDTO );
    }
}
